<style>
.item-up-content {background-color: #fff;border-radius: 10px;padding:0.5rem;margin:0.5rem 0}
.item-ng {}
.item-ng .deleteitem {position: absolute;color:#000;margin-top:-1rem;right:0.5rem}
</style>
<div class='fui-page fui-page-current' ng-if="pagedata.op=='main'">
	<div class="fui-header">
			<div class="fui-header-left" onclick="window.history.go(-1);">
				<a class="back"></a>
			</div>
			<div class="title">创建活动</div>
			<div class="fui-header-right"></div>
	</div>
	<div class="fui-content">
	<div style="padding:0 0.5rem;">
	<div class="weui_cells weui_cells_form">
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">活动名称<span class="must"></span></label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="text" ng-model="pagedata.post.title" value="{{pagedata.post.title}}" placeholder="请输入您的活动名称">
					</div>
				</div>
	</div>
	<div class="weui_cells_title">活动说明</div>
	<div class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea class="weui_textarea" ng-model="pagedata.post.remark" value="{{pagedata.post.remark}}" placeholder="请输入您的活动说明" rows="3"></textarea>
                    <div class="weui_textarea_counter">建议68个字以内！</div>
                </div>
            </div>
    </div>
		<div class="weui_cells weui_cells_form">
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">活动地址<span class="must"></span></label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="text" ng-model="pagedata.post.address" value="{{pagedata.post.address}}" placeholder="请输入您的活动地址">
					</div>
				</div>
	</div>
	<div class="weui_cells weui_cells_form">
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">活动预计时长<span class="must"></span></label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="number" ng-model="pagedata.post.duration" value="{{pagedata.post.duration}}" placeholder="请输入您的活动预计时长">
					</div>
				</div>
	</div>
	<div class="weui_cells weui_cells_form">
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">活动开始时间<span class="must"></span></label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="date" ng-model="pagedata.post.time" value="{{pagedata.post.time}}" placeholder="请输入活动开始时间">
					</div>
				</div>
	</div>
	<div class="weui_cells weui_cells_form">
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">报名截止时间<span class="must"></span></label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="date" ng-model="pagedata.post.end" value="{{pagedata.post.end}}" placeholder="请输入报名截止时间">
					</div>
				</div>
	</div>
	<div class="weui_cells weui_cells_form" >
			<div class="weui_cell">
					<div class="weui_cell_hd"><label class="weui_label">活动封面图<span class="must"></span></label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<ul class="weui_uploader_files" ng-if="pagedata.post.image">
							  <li class="weui_uploader_file" style="background-image:url({{tomedia(pagedata.post.image)}})"></li>
						</ul>
						<div class="weui_uploader_input_wrp">
							 <input class="weui_uploader_input" ng-click="up_file(pagedata.post,'image','image')" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
						</div>
					</div>
		</div>
		</div>
			<div class="weui_cells weui_cells_form">
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">活动报名费用</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="number" ng-model="pagedata.post.money" value="{{pagedata.post.money}}" placeholder="请输入您的活动报名费用">
					</div>
				</div>
			</div>
			<div class="weui_cells weui_cells_form">
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">最大报名人数</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="number" ng-model="pagedata.post.mannum" value="{{pagedata.post.mannum}}" placeholder="请输入您的活动允许最大报名人数">
					</div>
				</div>
			</div>
			<div class="weui_cells weui_cells_form">
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">活动发起方</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="text" ng-model="pagedata.post.organize" value="{{pagedata.post.organize}}" placeholder="请输入您的活动发起方">
					</div>
				</div>
			</div>
			<div class="weui_cells_title">活动幻灯片</div>
			<div class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <div class="weui_uploader">
                        <div class="weui_uploader_bd">
                            <ul class="weui_uploader_files">
                                <li ng-repeat="p in pagedata.post.images" class="weui_uploader_file" style="background-image:url('{{tomedia(p)}}')">
									<div class="upbtn" >
										<a style="color:#f60" href="javascript:;" ng-click="pagedata.post.images.splice($index-1,0,p);pagedata.post.images.splice($index+1,1)">上移</a>
										<a style="color:#f60" href="javascript:;" ng-click="pagedata.post.images.splice($index,1)">删除</a>
									</div>
								</li>
                            </ul>
                            <div class="weui_uploader_input_wrp" href="javascript:;" ng-click="images(pagedata.post,'images')"></div>
                        </div>
                    </div>
                </div>
            </div>
			</div>
			<div class="weui_cells_title">报名内容</div>
			<div class="item-up-content item-ng" ng-repeat="item in pagedata.post.diyfrom">
					<div class="deleteitem" ng-click="pagedata.post.diyfrom.splice($index,1)"><i class="icon icon-cuowu bold" style="color:#000"></i></div>
					<div class="weui_cells weui_cells_form">
						<div class="weui_cell weui_cell_switch">
							<div class="weui_cell_hd"><label class="weui_label bold">{{$index+1}}.{{item.typename}}:</label></div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="text" ng-model="item.title" placeholder="输入{{item.typename}}标题">
							</div>
						</div>
						<div class="weui_cell">
							<div class="weui_cell_hd weui_cell_primary"><label class="weui_label">是否必填?</label></div>
							<div class="weui_cell_ft">
								<input class="weui_switch" type="checkbox" ng-model="item.ismust">
							</div>
						</div>
						<div class="weui_cell" ng-repeat="d in item.value">
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="text" ng-model="d.title" placeholder="输入{{d.title}}">
							</div>
							<div class="weui_cell_ft" style="" ng-click="item.value.splice($index,1)">
								<i class="icon icon-cuowu bold" style="color:#000">删除</i>
							</div>
						</div>
						<div class="weui_cell" ng-if="item.type == 4 || item.type == 5">
							<div class="weui_cell_bd weui_cell_primary" ng-click="item.value.push({'title':'选项'+item.value.length});">
								+ 新选项
							</div>
						</div>
					</div>
			</div>
			<div class="item-up-content" style="padding:1rem;text-align:center;color:#999">
						<p>设置一项报名内容</p>
						<p>(点击下面图标添加报名内容)</p>
			</div>
			<div class="item-up-content">
				<div class="fui-icon-group noborder col-6" style="margin-top:0.5rem">
					<div class="fui-icon-col external" ng-click="pagedata.post.diyfrom.push({'typename':'填写项','type':1});">
						<div class="icon icon-green radius" style="height:0.8rem;line-height:0.8rem;"><i class="icon icon-lunbo" style="font-size:16px;color:#999;height:0.8rem;line-height:0.8rem;"></i></div>
						<div class="text" style="color: #999;padding:0">填写项</div>
					</div>
					<div class="fui-icon-col external" ng-click="pagedata.post.diyfrom.push({'typename':'图片','type':3});">
						<div class="icon icon-green radius" style="height:0.8rem;line-height:0.8rem;"><i class="icon icon-shuru" style="font-size:16px;color:#999;height:0.8rem;line-height:0.8rem;"></i></div>
						<div class="text" style="color: #999;padding:0">图片</div>
					</div>
					<div class="fui-icon-col external" ng-click="pagedata.post.diyfrom.push({'typename':'文本','type':6});">
						<div class="icon icon-green radius" style="height:0.8rem;line-height:0.8rem;"><i class="icon icon-tuwen" style="font-size:16px;color:#999;height:0.8rem;line-height:0.8rem;"></i></div>
						<div class="text" style="color: #999;padding:0">文本</div>
					</div>
					<div class="fui-icon-col external" ng-click="pagedata.post.diyfrom.push({'typename':'单选','type':4,'value':[]});">
						<div class="icon icon-green radius" style="height:0.8rem;line-height:0.8rem;"><i class="icon icon-tuwen" style="font-size:16px;color:#999;height:0.8rem;line-height:0.8rem;"></i></div>
						<div class="text" style="color: #999;padding:0">单选</div>
					</div>
					<div class="fui-icon-col external" ng-click="pagedata.post.diyfrom.push({'typename':'多选','type':5,'value':[]});">
						<div class="icon icon-green radius" style="height:0.8rem;line-height:0.8rem;"><i class="icon icon-tuwen" style="font-size:16px;color:#999;height:0.8rem;line-height:0.8rem;"></i></div>
						<div class="text" style="color: #999;padding:0">多选</div>
					</div>
					<div class="fui-icon-col external" ng-click="pagedata.post.diyfrom.push({'typename':'地址','type':7});">
						<div class="icon icon-green radius" style="height:0.8rem;line-height:0.8rem;"><i class="icon icon-tuwen" style="font-size:16px;color:#999;height:0.8rem;line-height:0.8rem;"></i></div>
						<div class="text" style="color: #999;padding:0">地址</div>
					</div>
				</div>
			</div>
	 </div>
	<div class="weui_btn_area">
		 <a class="weui_btn weui_btn_primary" href="javascript:" id="showTooltips" ng-click="pagedata.submit()">提交</a>
	</div>
</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script>
scope.pagedata.post.time=new Date(scope.pagedata.post.time);
scope.pagedata.post.end=new Date(scope.pagedata.post.end);
scope.pagedata.submit=function(){
	var dt=new Date(scope.pagedata.post.time);
	var sc=parseInt(dt.getTime()/1000);
	var t=scope.date(sc);
	//alert(t);return;
	//scope.pagedata.post.start=sc;
	scope.post(scope.pagedata.post,'main');
}
</script>